﻿using System;

namespace BF
{

    public interface IPool : IDisposable
    {
        /// <summary>
        /// 将对象从池中取出
        /// </summary>
        object Pop();
        /// <summary>
        /// 将对象放回池中
        /// </summary>
        bool Push(object item);
        /// <summary>
        /// 删除池中所有缓存对象,不包括正在使用的
        /// </summary>
        void DestroyAllItemCache();
    }

    public interface IPool<T> : IPool where T : class, IRecycleable
    {
        /// <summary>
        /// 将对象从池中取出
        /// </summary>
        new T Pop();

        /// <summary>
        /// 将对象放回池中
        /// </summary>
        bool Push(T item);
    }
}